﻿
using B.S.Warehouse.Domain;
using B.S.Warehouse.Domain.goods;
using SqlSugar;

namespace B.S.Warehouse.Infrastructrue
{
    public class SODbContext
    {

        public SqlSugarClient db { get; set; }
        public SODbContext()
        {
            db = new SqlSugarClient(new ConnectionConfig()
            {
                DbType = DbType.SqlServer,//使用Mysql数据库
                ConnectionString = "Server=10.223.8.81;DataBase=wanghaoran1;Uid=sa;Pwd=123456;Encrypt=True;TrustServerCertificate=True;",
                IsAutoCloseConnection = true,
                InitKeyType = InitKeyType.Attribute,

            });
            db.DbMaintenance.CreateDatabase();
            //入库主表
            db.CodeFirst.InitTables(typeof(StockInApplication));
            //入库明细子表
            db.CodeFirst.InitTables(typeof(StockInDetailS));
            //出库
            db.CodeFirst.InitTables(typeof(Outbounds));
            //出库明细
            db.CodeFirst.InitTables(typeof(OutboundDetailss));

            //仓库
            db.CodeFirst.InitTables(typeof(WareHouse));
            //库位
            db.CodeFirst.InitTables(typeof(StorageArea));
            //仓位表
            db.CodeFirst.InitTables(typeof(StorageLocation));
            //入库记录表
            db.CodeFirst.InitTables(typeof(IncomingRecord));
            //退货入库表
            db.CodeFirst.InitTables(typeof(ReturnIncoming));
            //自定义类型入库表
            db.CodeFirst.InitTables(typeof(CustomIncoming));
            //仓库类别表
            db.CodeFirst.InitTables(typeof(WareHouseType));

            //调拨表
            db.CodeFirst.InitTables(typeof(Allocate));
            //调拨明细表
            db.CodeFirst.InitTables(typeof(AllocationDetails));

            //货物表
            db.CodeFirst.InitTables(typeof(GoodsModel));



        }
    }
}
